#include "config.h"
#include "types.h"


const u8 cnv_2to4_tab[0x4] =
{
    0x0, 0x5, 0xA, 0xF
};

const u8 cnv_2to8_tab[0x4] =
{
    0x00, 0x55, 0xAA, 0xFF
};

const u16 cnv_2to16_tab[0x4] =
{
    0x0000, 0x5555, 0xAAAA, 0xFFFF
};

const u32 cnv_2to32_tab[0x4] =
{
    0x00000000, 0x55555555, 0xAAAAAAAA, 0xFFFFFFFF
};

const u8 cnv_4to8_tab[0x10] =
{
    0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
    0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};

const u16 cnv_4to16_tab[0x10] =
{
    0x0000, 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777,
    0x8888, 0x9999, 0xAAAA, 0xBBBB, 0xCCCC, 0xDDDD, 0xEEEE, 0xFFFF
};

const u32 cnv_4to32_tab[0x10] =
{
    0x00000000, 0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x55555555, 0x66666666, 0x77777777,
    0x88888888, 0x99999999, 0xAAAAAAAA, 0xBBBBBBBB, 0xCCCCCCCC, 0xDDDDDDDD, 0xEEEEEEEE, 0xFFFFFFFF
};

const u16 cnv_8to16_tab[0x100] =
{
    0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707,
    0x0808, 0x0909, 0x0A0A, 0x0B0B, 0x0C0C, 0x0D0D, 0x0E0E, 0x0F0F,
    0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717,
    0x1818, 0x1919, 0x1A1A, 0x1B1B, 0x1C1C, 0x1D1D, 0x1E1E, 0x1F1F,
    0x2020, 0x2121, 0x2222, 0x2323, 0x2424, 0x2525, 0x2626, 0x2727,
    0x2828, 0x2929, 0x2A2A, 0x2B2B, 0x2C2C, 0x2D2D, 0x2E2E, 0x2F2F,
    0x3030, 0x3131, 0x3232, 0x3333, 0x3434, 0x3535, 0x3636, 0x3737,
    0x3838, 0x3939, 0x3A3A, 0x3B3B, 0x3C3C, 0x3D3D, 0x3E3E, 0x3F3F,
    0x4040, 0x4141, 0x4242, 0x4343, 0x4444, 0x4545, 0x4646, 0x4747,
    0x4848, 0x4949, 0x4A4A, 0x4B4B, 0x4C4C, 0x4D4D, 0x4E4E, 0x4F4F,
    0x5050, 0x5151, 0x5252, 0x5353, 0x5454, 0x5555, 0x5656, 0x5757,
    0x5858, 0x5959, 0x5A5A, 0x5B5B, 0x5C5C, 0x5D5D, 0x5E5E, 0x5F5F,
    0x6060, 0x6161, 0x6262, 0x6363, 0x6464, 0x6565, 0x6666, 0x6767,
    0x6868, 0x6969, 0x6A6A, 0x6B6B, 0x6C6C, 0x6D6D, 0x6E6E, 0x6F6F,
    0x7070, 0x7171, 0x7272, 0x7373, 0x7474, 0x7575, 0x7676, 0x7777,
    0x7878, 0x7979, 0x7A7A, 0x7B7B, 0x7C7C, 0x7D7D, 0x7E7E, 0x7F7F,
    0x8080, 0x8181, 0x8282, 0x8383, 0x8484, 0x8585, 0x8686, 0x8787,
    0x8888, 0x8989, 0x8A8A, 0x8B8B, 0x8C8C, 0x8D8D, 0x8E8E, 0x8F8F,
    0x9090, 0x9191, 0x9292, 0x9393, 0x9494, 0x9595, 0x9696, 0x9797,
    0x9898, 0x9999, 0x9A9A, 0x9B9B, 0x9C9C, 0x9D9D, 0x9E9E, 0x9F9F,
    0xA0A0, 0xA1A1, 0xA2A2, 0xA3A3, 0xA4A4, 0xA5A5, 0xA6A6, 0xA7A7,
    0xA8A8, 0xA9A9, 0xAAAA, 0xABAB, 0xACAC, 0xADAD, 0xAEAE, 0xAFAF,
    0xB0B0, 0xB1B1, 0xB2B2, 0xB3B3, 0xB4B4, 0xB5B5, 0xB6B6, 0xB7B7,
    0xB8B8, 0xB9B9, 0xBABA, 0xBBBB, 0xBCBC, 0xBDBD, 0xBEBE, 0xBFBF,
    0xC0C0, 0xC1C1, 0xC2C2, 0xC3C3, 0xC4C4, 0xC5C5, 0xC6C6, 0xC7C7,
    0xC8C8, 0xC9C9, 0xCACA, 0xCBCB, 0xCCCC, 0xCDCD, 0xCECE, 0xCFCF,
    0xD0D0, 0xD1D1, 0xD2D2, 0xD3D3, 0xD4D4, 0xD5D5, 0xD6D6, 0xD7D7,
    0xD8D8, 0xD9D9, 0xDADA, 0xDBDB, 0xDCDC, 0xDDDD, 0xDEDE, 0xDFDF,
    0xE0E0, 0xE1E1, 0xE2E2, 0xE3E3, 0xE4E4, 0xE5E5, 0xE6E6, 0xE7E7,
    0xE8E8, 0xE9E9, 0xEAEA, 0xEBEB, 0xECEC, 0xEDED, 0xEEEE, 0xEFEF,
    0xF0F0, 0xF1F1, 0xF2F2, 0xF3F3, 0xF4F4, 0xF5F5, 0xF6F6, 0xF7F7,
    0xF8F8, 0xF9F9, 0xFAFA, 0xFBFB, 0xFCFC, 0xFDFD, 0xFEFE, 0xFFFF
};

const u32 cnv_8to32_tab[0x100] =
{
    0x00000000, 0x01010101, 0x02020202, 0x03030303, 0x04040404, 0x05050505, 0x06060606, 0x07070707,
    0x08080808, 0x09090909, 0x0A0A0A0A, 0x0B0B0B0B, 0x0C0C0C0C, 0x0D0D0D0D, 0x0E0E0E0E, 0x0F0F0F0F,
    0x10101010, 0x11111111, 0x12121212, 0x13131313, 0x14141414, 0x15151515, 0x16161616, 0x17171717,
    0x18181818, 0x19191919, 0x1A1A1A1A, 0x1B1B1B1B, 0x1C1C1C1C, 0x1D1D1D1D, 0x1E1E1E1E, 0x1F1F1F1F,
    0x20202020, 0x21212121, 0x22222222, 0x23232323, 0x24242424, 0x25252525, 0x26262626, 0x27272727,
    0x28282828, 0x29292929, 0x2A2A2A2A, 0x2B2B2B2B, 0x2C2C2C2C, 0x2D2D2D2D, 0x2E2E2E2E, 0x2F2F2F2F,
    0x30303030, 0x31313131, 0x32323232, 0x33333333, 0x34343434, 0x35353535, 0x36363636, 0x37373737,
    0x38383838, 0x39393939, 0x3A3A3A3A, 0x3B3B3B3B, 0x3C3C3C3C, 0x3D3D3D3D, 0x3E3E3E3E, 0x3F3F3F3F,
    0x40404040, 0x41414141, 0x42424242, 0x43434343, 0x44444444, 0x45454545, 0x46464646, 0x47474747,
    0x48484848, 0x49494949, 0x4A4A4A4A, 0x4B4B4B4B, 0x4C4C4C4C, 0x4D4D4D4D, 0x4E4E4E4E, 0x4F4F4F4F,
    0x50505050, 0x51515151, 0x52525252, 0x53535353, 0x54545454, 0x55555555, 0x56565656, 0x57575757,
    0x58585858, 0x59595959, 0x5A5A5A5A, 0x5B5B5B5B, 0x5C5C5C5C, 0x5D5D5D5D, 0x5E5E5E5E, 0x5F5F5F5F,
    0x60606060, 0x61616161, 0x62626262, 0x63636363, 0x64646464, 0x65656565, 0x66666666, 0x67676767,
    0x68686868, 0x69696969, 0x6A6A6A6A, 0x6B6B6B6B, 0x6C6C6C6C, 0x6D6D6D6D, 0x6E6E6E6E, 0x6F6F6F6F,
    0x70707070, 0x71717171, 0x72727272, 0x73737373, 0x74747474, 0x75757575, 0x76767676, 0x77777777,
    0x78787878, 0x79797979, 0x7A7A7A7A, 0x7B7B7B7B, 0x7C7C7C7C, 0x7D7D7D7D, 0x7E7E7E7E, 0x7F7F7F7F,
    0x80808080, 0x81818181, 0x82828282, 0x83838383, 0x84848484, 0x85858585, 0x86868686, 0x87878787,
    0x88888888, 0x89898989, 0x8A8A8A8A, 0x8B8B8B8B, 0x8C8C8C8C, 0x8D8D8D8D, 0x8E8E8E8E, 0x8F8F8F8F,
    0x90909090, 0x91919191, 0x92929292, 0x93939393, 0x94949494, 0x95959595, 0x96969696, 0x97979797,
    0x98989898, 0x99999999, 0x9A9A9A9A, 0x9B9B9B9B, 0x9C9C9C9C, 0x9D9D9D9D, 0x9E9E9E9E, 0x9F9F9F9F,
    0xA0A0A0A0, 0xA1A1A1A1, 0xA2A2A2A2, 0xA3A3A3A3, 0xA4A4A4A4, 0xA5A5A5A5, 0xA6A6A6A6, 0xA7A7A7A7,
    0x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E, 0xFFFFFFFF
};


const u8 cnv_bcd_tab[100] =
{
    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99
};

